Boundary SPH

Boundary SPH for Robust Particle-Mesh Interaction in Three Dimensions

    • Date(s): May 2024
    • Topics: Fluid Models, Parallelization, GPUs
    • Tech Stack: Unity (Game Engine), C#/CSharp, HLSL
    • Collaborators:
    • Links: PDFGithubDOI

Smoothed Particle Hydrodynamics (SPH) is a well-established method for simulating weakly or non-compressible fluids. Its particle physics are driven by Navier-Stokes equations, which are commonly used to model pressure forces between particles. SPH relies on the idea of identifying neighbor particles for each particle, determining the overall pressure forces applied to said particles based on qualities such as mass, density, and temperature, and then enacting those forces in discrete timesteps. It’s difficult to conduct SPH simulations on the CPU, however - imagine trying to replicate these steps for thousands, maybe millions, of individual particles. The overhead alone will lag the simulation significantly. To solve this, parallelization scemes are required. If you’re using a game engine like Unity, then your likely solution would be to use HLSL compute shaders to drive GPU operations.

There are some issues with particle systems like SPH. Namely, they treat particles as point masses, which prevents rigidbody mesh-based collisions with meshed objects. If driven by parallelization using a GPU, then another bottleneck is in the communication between the CPU and GPU. I wanted to see if we could solve this by moving mesh data from the CPU to the GPU and using signed distance calculations and voronoi region logic to measure the intersection of particles with mesh surfaces.

Goals

This project effectively is an exploration of whether this method is not only possible but efficient in terms of FPS. If this method was achievable, then we could replicate mesh transformations by simply converting Unity matrix transformations from the CPU to the GPU, then conduct mesh transformations via matrix operations. My method - which I refer to as “boundary SPH” (BSPH) - successfully accomplishes these ideas. I have some samples below that demonstrate these. Keep in mind - these also include early implementations!

NoteSomething new for me

For full disclosure, I wasn’t exactly familiar with particle simulation before this project. This was my first project where I had to handle parallelization schemes for large-scale particle simulations. And in Unity no less! Terrifying, to be sure. I first started this project as a collaborative measure to model realistic physics of underwater phenomena (i.e. underwater currents, pressure) in interaction with simulated underwater robots. When our collaborator left, I ended up taking over the project.

NoteDownload the report here

Download the report here: Download Manuscript PDF (18.0 mB)

SPH Mesh Boundary Condition: Velocity #3
SPH Mesh Boundary Condition: Velocity #4
SPH Mesh Boundary Condition: 1-Way Coupling
SPH Mesh Boundary Condition: Friction Condition
SPH Mesh Boundary Condition: No-Friction Condition
SPH Mesh Boundary Condition: Flow Field Test (Cooking Pot)
SPH Mesh Boundary Condition: Flow Field Test (Torus)
SPH Mesh Boundary Condition: Flow Field Test (Sphere)